home *** CD-ROM | disk | FTP | other *** search
Wrap
sssseeeemmmmoooopppp((((2222)))) sssseeeemmmmoooopppp((((2222)))) NNNNAAAAMMMMEEEE _ssss_eeee_mmmm_oooo_pppp - semaphore operations SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>> _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_iiii_pppp_cccc_...._hhhh_>>>> _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_eeee_mmmm_...._hhhh_>>>> _iiii_nnnn_tttt _ssss_eeee_mmmm_oooo_pppp_((((_iiii_nnnn_tttt _ssss_eeee_mmmm_iiii_dddd_,,,, _ssss_tttt_rrrr_uuuu_cccc_tttt _ssss_eeee_mmmm_bbbb_uuuu_ffff _****_ssss_oooo_pppp_ssss_,,,, _ssss_iiii_zzzz_eeee______tttt _nnnn_ssss_oooo_pppp_ssss_))))_;;;; DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _ssss_eeee_mmmm_oooo_pppp is used to perform atomically an array of semaphore operations on the set of semaphores associated with the semaphore identifier specified by _s_e_m_i_d. _s_o_p_s is a pointer to the array of semaphore-operation structures. _n_s_o_p_s is the number of such structures in the array. The contents of each structure includes the following members: _ssss_hhhh_oooo_rrrr_tttt _ssss_eeee_mmmm______nnnn_uuuu_mmmm_;;;; _////_**** _ssss_eeee_mmmm_aaaa_pppp_hhhh_oooo_rrrr_eeee _nnnn_uuuu_mmmm_bbbb_eeee_rrrr _****_//// _ssss_hhhh_oooo_rrrr_tttt _ssss_eeee_mmmm______oooo_pppp_;;;; _////_**** _ssss_eeee_mmmm_aaaa_pppp_hhhh_oooo_rrrr_eeee _oooo_pppp_eeee_rrrr_aaaa_tttt_iiii_oooo_nnnn _****_//// _ssss_hhhh_oooo_rrrr_tttt _ssss_eeee_mmmm______ffff_llll_gggg_;;;; _////_**** _oooo_pppp_eeee_rrrr_aaaa_tttt_iiii_oooo_nnnn _ffff_llll_aaaa_gggg_ssss _****_//// Each semaphore operation specified by _s_e_m__o_p is performed on the corresponding semaphore specified by _s_e_m_i_d and _s_e_m__n_u_m. _s_e_m__o_p specifies one of three semaphore operations as follows, depending on whether its value is negative, positive, or zero: If _s_e_m__o_p is a negative integer, one of the following occurs: {ALTER} If _ssss_eeee_mmmm_vvvv_aaaa_llll [see _iiii_nnnn_tttt_rrrr_oooo(2)] is greater than or equal to the absolute value of _s_e_m__o_p, the absolute value of _s_e_m__o_p is subtracted from _ssss_eeee_mmmm_vvvv_aaaa_llll. Also, if (_s_e_m__f_l_g_&&&&_SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO) is true, the absolute value of _s_e_m__o_p is added to the calling process's _ssss_eeee_mmmm_aaaa_dddd_jjjj value [see _eeee_xxxx_iiii_tttt(2)] for the specified semaphore. If _ssss_eeee_mmmm_vvvv_aaaa_llll is less than the absolute value of _s_e_m__o_p and (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is true, _ssss_eeee_mmmm_oooo_pppp returns immediately. If _ssss_eeee_mmmm_vvvv_aaaa_llll is less than the absolute value of _s_e_m__o_p and (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is false, _ssss_eeee_mmmm_oooo_pppp increments the _ssss_eeee_mmmm_nnnn_cccc_nnnn_tttt associated with the specified semaphore and suspends execution of the calling process until one of the following conditions occur. _ssss_eeee_mmmm_vvvv_aaaa_llll becomes greater than or equal to the absolute value of _s_e_m__o_p. When this occurs, the value of _ssss_eeee_mmmm_nnnn_cccc_nnnn_tttt associated with the specified semaphore is decremented, the absolute value of _s_e_m__o_p is subtracted from _ssss_eeee_mmmm_vvvv_aaaa_llll and, if (_s_e_m__f_l_g_&&&&_SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO) is true, the absolute value of _s_e_m__o_p is added to the calling process's _ssss_eeee_mmmm_aaaa_dddd_jjjj value for the specified semaphore. PPPPaaaaggggeeee 1111 sssseeeemmmmoooopppp((((2222)))) sssseeeemmmmoooopppp((((2222)))) The _s_e_m_i_d for which the calling process is awaiting action is removed from the system [see _ssss_eeee_mmmm_cccc_tttt_llll(2)]. When this occurs, _eeee_rrrr_rrrr_nnnn_oooo is set equal to _EEEE_IIII_DDDD_RRRR_MMMM, and a value of -1 is returned. The calling process receives a signal that is to be caught. When this occurs, the value of _ssss_eeee_mmmm_nnnn_cccc_nnnn_tttt associated with the specified semaphore is decremented, and the calling process resumes execution in the manner prescribed in _ssss_iiii_gggg_nnnn_aaaa_llll(2). If _s_e_m__o_p is a positive integer, the value of _s_e_m__o_p is added to _ssss_eeee_mmmm_vvvv_aaaa_llll and, if (_s_e_m__f_l_g_&&&&_SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO) is true, the value of _s_e_m__o_p is subtracted from the calling process's _ssss_eeee_mmmm_aaaa_dddd_jjjj value for the specified semaphore. - {ALTER} If _s_e_m__o_p is zero, one of the following occurs: {READ} If _ssss_eeee_mmmm_vvvv_aaaa_llll is zero, _ssss_eeee_mmmm_oooo_pppp returns immediately. If _ssss_eeee_mmmm_vvvv_aaaa_llll is not equal to zero and (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is true, _ssss_eeee_mmmm_oooo_pppp returns immediately. If _ssss_eeee_mmmm_vvvv_aaaa_llll is not equal to zero and (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is false, _ssss_eeee_mmmm_oooo_pppp increments the _ssss_eeee_mmmm_zzzz_cccc_nnnn_tttt associated with the specified semaphore and suspends execution of the calling process until one of the following occurs: Semval becomes zero, at which time the value of _ssss_eeee_mmmm_zzzz_cccc_nnnn_tttt associated with the specified semaphore is decremented. The _s_e_m_i_d for which the calling process is awaiting action is removed from the system. When this occurs, _eeee_rrrr_rrrr_nnnn_oooo is set equal to _EEEE_IIII_DDDD_RRRR_MMMM, and a value of -1 is returned. The calling process receives a signal that is to be caught. When this occurs, the value of _ssss_eeee_mmmm_zzzz_cccc_nnnn_tttt associated with the specified semaphore is decremented, and the calling process resumes execution in the manner prescribed in _ssss_iiii_gggg_nnnn_aaaa_llll(2). _ssss_eeee_mmmm_oooo_pppp fails if one or more of the following are true for any of the semaphore operations specified by _s_o_p_s: _EEEE_IIII_NNNN_VVVV_AAAA_LLLL _s_e_m_i_d is not a valid semaphore identifier. _EEEE_FFFF_BBBB_IIII_GGGG _s_e_m__n_u_m is less than zero or greater than or equal to the number of semaphores in the set associated with _s_e_m_i_d. _EEEE_2222_BBBB_IIII_GGGG _n_s_o_p_s is greater than the system-imposed maximum. _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS Operation permission is denied to the calling process [see _iiii_nnnn_tttt_rrrr_oooo(2)]. PPPPaaaaggggeeee 2222 sssseeeemmmmoooopppp((((2222)))) sssseeeemmmmoooopppp((((2222)))) _EEEE_AAAA_GGGG_AAAA_IIII_NNNN The operation would result in suspension of the calling process but (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is true. _EEEE_NNNN_OOOO_SSSS_PPPP_CCCC The limit on the number of individual processes requesting an _SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO would be exceeded. _EEEE_IIII_NNNN_VVVV_AAAA_LLLL The number of individual semaphores for which the calling process requests a _SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO would exceed the limit. _EEEE_RRRR_AAAA_NNNN_GGGG_EEEE An operation would cause a _ssss_eeee_mmmm_vvvv_aaaa_llll to overflow the system- imposed limit. _EEEE_RRRR_AAAA_NNNN_GGGG_EEEE An operation would cause a _ssss_eeee_mmmm_aaaa_dddd_jjjj value to overflow the system-imposed limit. _EEEE_FFFF_AAAA_UUUU_LLLL_TTTT _s_o_p_s points to an illegal address. _EEEE_IIII_DDDD_RRRR_MMMM A _s_e_m_i_d referenced by the call was removed from the system. Other errors which can occur on _ssss_eeee_mmmm_oooo_pppp are: _EEEE_IIII_NNNN_TTTT_RRRR _ssss_eeee_mmmm_oooo_pppp(2) was interrupted by a signal. Upon successful completion, the value of _ssss_eeee_mmmm_pppp_iiii_dddd for each semaphore specified in the array pointed to by _s_o_p_s is set equal to the process ID of the calling process. SSSSEEEEEEEE AAAALLLLSSSSOOOO _iiii_nnnn_tttt_rrrr_oooo(2), _eeee_xxxx_eeee_cccc(2), _eeee_xxxx_iiii_tttt(2), _ffff_oooo_rrrr_kkkk(2), _ssss_eeee_mmmm_cccc_tttt_llll(2), _ssss_eeee_mmmm_gggg_eeee_tttt(2). DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS If _s_e_m_o_p returns due to the receipt of a signal, a value of -1 is returned to the calling process and _eeee_rrrr_rrrr_nnnn_oooo is set to _EEEE_IIII_NNNN_TTTT_RRRR. If it returns due to the removal of a _s_e_m_i_d from the system, a value of -1 is returned and _eeee_rrrr_rrrr_nnnn_oooo is set to _EEEE_IIII_DDDD_RRRR_MMMM. Upon successful completion, a value of zero is returned. Otherwise, a value of -1 is returned and _eeee_rrrr_rrrr_nnnn_oooo is set to indicate the error. PPPPaaaaggggeeee 3333